﻿using Microsoft.EntityFrameworkCore;


namespace SharedFeatures;

public class 全局默认设置 : DbContext
{
    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
    {
        // 非跟踪查询默认启用标识解析
        optionsBuilder.UseQueryTrackingBehavior(QueryTrackingBehavior.NoTrackingWithIdentityResolution);

        optionsBuilder.UseSqlServer(
            "连接字符串",
            options =>
            {
                // 拆分查询是依赖特定数据库驱动程序的功能，因此需要在数据库驱动选项中配置
                options.UseQuerySplittingBehavior(QuerySplittingBehavior.SplitQuery);
            });
    }

}
